int** matrixReshape(int** mat, int matSize, int* matColSize, int r, int c, int* returnSize, int** returnColumnSizes) {
    int m=matSize;
    int n=matColSize[0];
    if(m*n!=r*c)
    {
        *returnSize = matSize;
        *returnColumnSizes = matColSize;
        return mat;
    }  
        

    *returnSize = r;
    *returnColumnSizes = malloc(sizeof(int)*r);
    int **ret=malloc(sizeof(int*)*r);

    for(int i=0;i<r;i++)
    {
        (*returnColumnSizes)[i] = c;
        ret[i] = malloc(sizeof(int)*c);
    }
    for(int k=0;k<m*n;k++)
    {
        ret[k/c][k%c]=mat[k/n][k%n];
    }
    return ret;
}